package com.chx.mapper;

import com.chx.entity.Permissions;
import com.chx.entity.RolePermissions;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author cp-月入过万
 * @Date 2025/5/30
 */
@Mapper
public interface PermissionMapper {

    @Select("select * from permissions")
    List<Permissions> getAllPermission();

    @Delete("delete from role_permissions where role_id = #{id}")
    void delete(Long id);

    @Insert("insert into role_permissions(role_id,permission_id) " +
            "values" +
            "(#{roleId},#{permissionId})")
    void insert(RolePermissions rolePermissions);

    List<Permissions> getPermissionById(Long id);
}
